package dto

import "django_blog_gin/internal/model"

type UserLoginReq struct {
	Username string `json:"username" binding:"required,min=3,max=20"`
	Password string `json:"password" binding:"required"`
}

type RefreshReq struct {
	RefreshToken string `json:"refresh_token" binding:"required"`
}

type CheckReq struct {
	Token string `json:"token" binding:"required"`
}

type GetUserDetailReq struct {
	Id int `json:"id" binding:"required"`
}

type GetArticleDetailReq struct {
	Id int `json:"id" binding:"required"`
}

type ArticleWithTagsResp struct {
	model.BlogArticleWithTags
	CreatedTime string   `json:"created_time"`
	LastModTime string   `json:"last_mod_time"`
	PubTime     string   `json:"pub_time"`
	Tags        []string `json:"tags"`
}

type UpdateBlogArticleReq struct {
	Id            int    `db:"id" json:"id" binding:"required"`
	Title         string `db:"title" json:"title" binding:"required"`
	Body          string `db:"body" json:"body" binding:"required"`
	Status        string `db:"status" json:"status" binding:"required"`
	CommentStatus string `db:"comment_status" json:"comment_status" binding:"required"`
	PubTime       string `db:"pub_time" json:"pub_time" binding:"required"`
	Type          string `db:"type" json:"type" binding:"required"`
	ArticleOrder  int    `db:"article_order" json:"article_order" binding:"min=0"`
	ShowToc       bool   `db:"show_toc" json:"show_toc" binding:"omitempty"`
	CategoryId    int    `db:"category_id" json:"category_id" binding:"required"`
	TagIds        []int  `db:"tag_ids" json:"tag_ids" binding:"required"`
	// Views         int    `json:"views" binding:"required"`
	// AuthorId      int    `json:"author_id" binding:"required"`
}

type UpdateBlogSettingsListReq struct {
	Id                  int    `json:"id" binding:"required"`
	Sitename            string `json:"sitename" binding:"required"`
	SiteDescription     string `json:"site_description" binding:"required"`
	SiteSeoDescription  string `json:"site_seo_description" binding:"required"`
	SiteKeywords        string `json:"site_keywords" binding:"required"`
	ArticleSubLength    int    `json:"article_sub_length" binding:"required"`
	SidebarArticleCount int    `json:"sidebar_article_count" binding:"required"`
	SidebarCommentCount int    `json:"sidebar_comment_count" binding:"required"`
	ArticleCommentCount int    `json:"article_comment_count" binding:"required"`
	ShowGoogleAdSense   bool   `json:"show_google_adsense" binding:"required"`
	GoogleAdsenseCodes  string `json:"google_adsense_codes" binding:"required"`
	OpenSiteComment     bool   `json:"open_site_comment" binding:"required"`
	Beiancode           string `json:"beiancode" binding:"required"`
	Analyticscode       string `json:"analyticscode" binding:"required"`
	ShowGonganCode      bool   `json:"show_gongan_code" binding:"required"`
	GonganBeiancode     string `json:"gongan_beiancode" binding:"required"`
}

type UpdateCategoryReq struct {
	Id               int    `json:"id" binding:"required"`
	Name             string `json:"name" binding:"required"`
	Slug             string `json:"slug" binding:"required"`
	Index            int    `json:"index" binding:"required"`
	ParentCategoryID int    `json:"parent_category_id" binding:"omitempty"`
}

type UpdateTagReq struct {
	Id    int    `json:"id" binding:"required"`
	Name  string `json:"name" binding:"required"`
	Slug  string `json:"slug" binding:"required"`
	Index int    `json:"index" binding:"required"`
}
